package org.example.Mapper;

import lombok.Data;

import org.apache.ibatis.annotations.*;
import org.example.entity.Student;

import java.util.List;
//Dao 与数据库进行交互？？
@Mapper //声明这是一个mapper文件 在spring中不用加这个标识 但是在boot中需要
public interface Studentmapper {

    @Insert("insert into students(id,name,age,gender) values (#{id},#{name},#{age},#{gender})")
    void insert(Student student);

    @Delete("delete from students where id = #{id}")
    void delete (Integer id);

    @Update("update students set name = #{name},age = #{age},gender = #{gender} where id = #{id}")
    void update (Student student);

    @Select("select * from students where id = #{id}")
    Student getid (Integer id);

    @Select("select * from students ")
    List<Student> getall();


}
